#ifndef _EB0_TASK_MANAGER_H_
#define _EB0_TASK_MANAGER_H_

#include <EB0/Prereq.h>
#include <set>

// TaskManager is a singleton used among the entire game regardless of windows.
// Tasks will be processed every game tick in no specific order.

namespace EB0
{
namespace Managers
{
	class TaskManager
	{
	public:
		~TaskManager();

		void update(float dt = 0.0f);

		void addTask(Tasks::GameTask* gameTask);
		void removeTask(Tasks::GameTask* gameTask);
		void removeAllTasks();

		static TaskManager& getSingleton();
		static TaskManager* getSingletonPtr();

	private:
		typedef std::set<Tasks::GameTask*> GameTaskSet;

		TaskManager();
		TaskManager(const TaskManager&) {}
		TaskManager &operator=(const TaskManager&);

		GameTaskSet mTasks;

		bool mDirtyTaskSet;

		mutable sf::Mutex mMutex;
		static TaskManager* mSingleton;
	};
} // namespace Managers
}

#endif // _EB0_TASK_MANAGER_H_